Skip to content

test: 100% coverage required in CI, measured badge with the full report (ADR 0015) - #23

Merged
Akinzou merged 1 commit into
masterfrom
test/coverage
Nov 12, 2026
Merged

Akinzou merged 1 commit into
masterfrom
test/coverage

Conversation

@Akinzou

@Akinzou Akinzou commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What

  • Coverage is 100% of lines and branches: 1476 statements and 364 branches. That includes the release scripts in scripts/, which are now measured too.
  • CI requires 100% (fail_under = 100). The number shown cannot slip unnoticed.
  • README badge measured on master. A new coverage job in docs.yml publishes the HTML report at https://akinzou.github.io/MetaTrader5-Python/coverage/ and a coverage.json that the badge reads through shields.io. Clicking the badge opens the line-by-line report.
  • run_batch reads results with isinstance, like the rest of application/. A non-Result now fails loudly instead of being skipped into Ok([]); through the public API it was unreachable.

Why this badge

Option Verdict
Codecov / Coveralls Rejected: an account, a token in the repo's secrets and the source uploaded, for the same badge
Static shields.io badge with the number typed in Rejected: stale at the first change, and nothing notices
Measured on master, published with the site Chosen: always current, with the full report one click away

Verification

  • Local: ruff, ruff format, mypy, pytest (434 passed, 9 skipped, 100.00% coverage), check_file_length.py, mkdocs build --strict.
  • Docs build dry run: coverage_badge.py writes {"message": "100%", "color": "brightgreen"} and the HTML report builds.

Review

/code-review high, 8 findings.

Fixed:

  • the tests and dev tools now run in their own job, so they no longer share a machine with the site artifact;
  • the batch guard, which would have dropped receipts mid-loop, is replaced by the isinstance pattern;
  • the git ls-files test no longer needs a checkout;
  • the badge script gives clear messages on bad input;
  • a CHANGELOG "Fixed" entry for a bug that could not be reached through the API is removed.

Not changed:

  • One extra test run (about 30 s) in docs.yml: chosen over coupling the deploy to another workflow's artifacts.
  • 100% on Python 3.10: checked by this PR's CI matrix, since 3.10 is not installed locally.

…asured badge

- Coverage now also measures scripts/, which decide what reaches PyPI; new
  tests cover their remaining paths (browser missing, no pinned Mermaid, a
  diagram with no heading above it, a diagram that swallowed a fence, git).
- run_batch reads each result with isinstance, as the rest of application/
  does, so a match without a fallback no longer leaves an untestable branch;
  a non-Result fails loudly instead of being skipped into Ok([]).
- fail_under = 100.
- docs.yml gets a coverage job that publishes the HTML report under
  /coverage/ and coverage.json, which the README badge reads through
  shields.io (ADR 0015). Only its output joins the site artifact.

Chose a self-hosted, measured badge over Codecov because it needs no account,
token or source upload for the same badge, and over a static badge because a
typed number goes stale at the first change. Chose a separate coverage job over
running the tests in the build job because the dev tools and tests must not
share a machine with the site artifact.
@Akinzou
Akinzou merged commit 37cae12 into master Nov 12, 2026
12 checks passed
@Akinzou
Akinzou deleted the test/coverage branch November 14, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant